package cn.tedu.six2202.day03;

public class LazySingletonTest {
    public static void main(String[] args) {
//        HungrySingleton singleton1 = HungrySingleton.getInstance();
//        HungrySingleton singleton2 = HungrySingleton.getInstance();
//
//        System.out.println(singleton1);
//        System.out.println(singleton2);

        Thread thread1 = new Thread(){
            @Override
            public void run() {
                HungrySingleton singleton = HungrySingleton.getInstance();
                System.out.println(singleton);
            }
        };

        Thread thread2 = new Thread(){
            @Override
            public void run() {
                HungrySingleton singleton = HungrySingleton.getInstance();
                System.out.println(singleton);
            }
        };

        thread1.start();
        thread2.start();
    }
}
